<?php
/**
 * 
 * Stores location details.
 * @author udit
 *
 */
class Reale_Model_Location 
{
	/**
	 *
	 *Stores adress line
	 *@var string
	 */
	protected $_addressline;
	
	/**
	 *
	 *Stores city|village|town
	 *@var string
	 */
	protected $_place;
	
	/**
	 * 
	 * Stores district
	 * @var string
	 */
	protected $_district;
	
	/**
	 * 
	 * Stores state
	 * @var state
	 */
	protected $_state;
	
	/**
	 * 
	 * Stores postal code
	 * var int|string
	 */
	protected $_postalcode;

	/**
     * Constructor
     * 
     * @param  array|null $options 
     * @return void
     */
    public function __construct(array $options = null)
    {
        if (is_array($options)) {
            $this->setOptions($options);
        }
    }
    
    
    /**
     * Overloading: allow property access
     * 
     * @param  string $name 
     * @param  mixed $value 
     * @return void
     */
    public function __set($name, $value)
    {
        $method = 'set' . $name;
        if ('mapper' == $name || !method_exists($this, $method)) {
            throw new Zend_Exception('Invalid property specified',Zend_Log::DEBUG);
        }
        $this->$method($value);
    }

    /**
     * Overloading: allow property access
     * 
     * @param  string $name 
     * @return mixed
     */
    public function __get($name)
    {
        $method = 'get' . $name;
        if ('mapper' == $name || !method_exists($this, $method)) {
             throw new Zend_Exception('Invalid property specified',Zend_Log::DEBUG);
        }
        return $this->$method();
    }
    
    /**
     * Set object state
     * 
     * @param  array $options 
     * @return Reale_Model_Users_Agent
     */
    public function setOptions(array $options)
    {
        $methods = get_class_methods($this);
        foreach ($options as $key => $value) {
            $method = 'set' . ucfirst($key);
            if (in_array($method, $methods)) {
                $this->$method($value);
            }
        }
        return $this;
    }
    
	/**
	 * 
	 * Setter for $_addressline
	 * @param string $addressline
	 * @return Reale_Model_Location
	 */
	public function setAddressline($addressline){
		$this->_addressline = $addressline;
		return $this;
	}
	
	/**
	 * 
	 * Getter for $_addressline
	 * @return string $_addressline
	 */
	public function getAddressline(){
		return $this->_addressline;
	}
	
	/**
	 * 
	 * Setter for $_place
	 * @param string $place
	 * @return Reale_Model_Location
	 */
	public function setPlace($place){
		$this->_place = $place;
		return $this;
	}
	
	/**
	 * 
	 * Getter for $_place
	 * @return string $_place
	 */
	public function getPlace(){
		return $this->_place;
	}
	
	/**
	 * 
	 * Setter for $_district
	 * @param string $district
	 * @return Reale_Model_Location
	 */
	public function setDistrict($district){
		$this->_district = $district;
		return $this;
	}
	
	/**
	 * 
	 * Getter for $_district
	 * @return string $_district
	 */
	public function getDistrict(){
		return $this->_district;
	}
	
	/**
	 * 
	 * Setter for $_state
	 * @param string $state
	 * @return Reale_Model_Location
	 */
	public function setState($state){
		$this->_state = $state;
		return $this;
	}
	
	/**
	 * 
	 * Getter for $_state
	 * @return string $_state
	 */
	public function getState(){
		return $this->_state;
	}
	
	/**
	 * 
	 * Setter for $_postalcode
	 * @param string $postalcode
	 * @return Reale_Model_Location
	 */
	public function setPostalcode($postalcode){
		$this->_postalcode = $postalcode;
		return $this;
	}
	
	/**
	 * 
	 * Getter for $_postalcode
	 * @return string $_postalcode
	 */
	public function getPostalcode(){
		return $this->_postalcode;
	}
	
}

